﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.SqlClient;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace DIProject.ReceptionGoods
{	public partial class Order : Form
	{	private	Util.ActionType actionType;
		private	Orders orders;
//-------------------------------------------------------------------------------------------------
	//	private	DIProject.DataSets.Stock repricesStock{get{return reprices != null? reprices.stock: null;}}
	//	private	DIProject.DataSets.StockTableAdapters.RepricesTableAdapter repricesTableAdapter{get{return reprices != null? reprices.repricesTableAdapter: null;}}
		private	DIProject.DataSets.waybillsData.OrdersRow ordersRow = null;
	//	private	int docId{get{return repricesRow != null? repricesRow.Id: 0;}}
	//	private	string docNumber{get{return repricesRow != null? repricesRow.DocNumber: Properties.Resources.strUndefined;}}
	//	private	string docDate{get{return repricesRow != null? repricesRow.DocDate.ToString("d"): Properties.Resources.strUndefined;}}
//-------------------------------------------------------------------------------------------------
		public Order() : this(Util.ActionType.NoAction, null)
		{
		}
		public Order(Util.ActionType actionType, Orders orders)
		{	InitializeComponent();
			textFormat = Text;
			this.actionType	= actionType;
			this.orders		= orders;
		//	toolStripButtonUpdate.Enabled = false;
		//	toolStripButtonDelete.Enabled = false;
			if(actionType == DIProject.Util.ActionType.Update
			&& orders != null
			&& orders.ordersGridView.CurrentCell != null)
				ordersRow = (DIProject.DataSets.waybillsData.OrdersRow)((DataRowView)orders.ordersGridView.CurrentCell.OwningRow.DataBoundItem).Row;
		}
//-------------------------------------------------------------------------------------------------
		private readonly string textFormat;
		private void SetCaption()
		{//	Text = string.Format
		//	(	textFormat
		//	,	docNumber
		//	,	docDate
		//	);
		}
//-------------------------------------------------------------------------------------------------
		private void Order_Load(object sender, EventArgs e)
		{
			orderMTableAdapter.Fill(waybillsData.OrderM, 0);
			orderSTableAdapter.Fill(waybillsData.OrderS, 0);
		}
//-------------------------------------------------------------------------------------------------
	}
}